﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using UMEVOR.BLL;
using UMEVOR.DTO;
using UMEVOR.VO;

public partial class Portal_Divulgador : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack && !this.IsCallback)
        {
            txtPalestrante.Text = "";
            gvPalestra.DataSource = null;
            gvPalestra.DataBind();
        }
    }
    protected void btPesquisar_Click(object sender, ImageClickEventArgs e)
    {
        BLLT_PALESTRA bllPalestra = new BLLT_PALESTRA();
        gvPalestra.DataSource = bllPalestra.consultar(txtPalestrante.Text, 0, DateTime.Parse("01/01/0001"));
        gvPalestra.DataBind();

        Session["palestrante"] = txtPalestrante.Text;
    }
    protected void gvPalestra_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        BLLT_PALESTRA bllPalestra = new BLLT_PALESTRA();
        gvPalestra.DataSource = bllPalestra.consultar(txtPalestrante.Text, 0, DateTime.Parse("01/01/0001"));
        gvPalestra.DataBind();
    }
    protected void gvPalestra_RowCreated(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.DataItem != null)
        {
            VOT_PALESTRA palestra = (VOT_PALESTRA)e.Row.DataItem;

            Label lblHorario = (Label)e.Row.FindControl("lblHorario");


            string hora = palestra.HR_PALESTRA.ToString("HH:mm");

            if (hora.Equals("00:00"))
                hora = "";

            lblHorario.Text = palestra.DT_PALESTRA.ToString("dd/MM/yyyy") + " " + hora;
        }
    }
}
